package aop;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import bean.Bean;

public class AdviceDemo {
    private AbstractApplicationContext context;
    private Bean bean;
    
    @Before
    public void before() {
        context = new ClassPathXmlApplicationContext("/spring-config.xml");
        bean = (Bean) context.getBean("adviceBeanProxy");
    }
    
    @Test
    public void main() {
        bean.method2();
        bean.method1();
    }
    
    @After
    public void end() {
        context.close();
    }
}
